/*
package com.spring.service.impl;

import com.spring.dao.ModuleDao;
import com.spring.dao.UserDao;
import com.spring.pojo.SysModule;
import com.spring.pojo.SysUser;
import com.spring.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

*/
/**
 * @author tang
 *//*

@Service("userService")
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
public class UserServiceImpl implements UserService {

    @Autowired
    UserDao userDao;
    @Autowired
    ModuleDao moduleDao;
    @Override
    public SysUser login(String name, String psw) {
        Map<String,Object> params =new HashMap<String,Object>();
        params.put("name",name);
        params.put("psw",psw);
        return userDao.selectByNameAndPwd(params);
    }

    @Override
    public List<SysModule> selectModuleByUserId(String userId) {
        List<SysModule> result=new ArrayList<SysModule>();
        List<SysModule> modules=moduleDao.getAllModule();
        if(modules==null){
            modules=new ArrayList<SysModule>();
        }
        List<String> mids=moduleDao.getmoduleCodes(userId);
        if(mids ==null){
            mids= new ArrayList<String>();
        }
        //clear(modules,mids);
        for(int i=0;i<modules.size();i++){
            SysModule m=modules.get(i);
            if(m.getParentCode()!=null && m.getParentCode().equals("0")){
                //resetMoudle2(m,modules);
                result.add(m);
            }

        }
        return result;
    }
}
*/
